import { FormSchema } from '/@/components/Form';
import { getMethods } from '/@/api/monitor/setting';
import {getMetrics} from "/@/api/monitor/metric";

export const schemas: FormSchema[] = [
  {
    field: 'nickname',
    component: 'Input',
    label: '配置名称',
    colProps: {
      span: 24,
    },
    required: true,
  },
  {
    field: 'length',
    component: 'RadioButtonGroup',
    defaultValue: '5',
    label: '聚合时长',
    colProps: {
      span: 24,
    },
    componentProps: {
      options: [
        { label: ' 5分钟', value: '5' },
        { label: '10分钟', value: '10' },
        { label: '20分钟', value: '20' },
        { label: '30分钟', value: '30' },
      ],
    },
    required: true,
  },
  {
    field: 'method',
    component: 'ApiSelect',
    label: '聚合方法',
    colProps: {
      span: 24,
    },
    componentProps: {
      api: getMethods,
      labelField: 'name',
      valueField: 'name',
    },
    required: true,
  },
  {
    field: 'metric',
    component: 'ApiSelect',
    label: '聚合指标',
    colProps: {
      span: 24,
    },
    componentProps: {
      api: getMetrics,
      labelField: 'name',
      valueField: 'name',
    },
    required: true,
  },
  {
    field: 'enable',
    component: 'RadioButtonGroup',
    defaultValue: '0',
    label: '启用状态',
    colProps: {
      span: 24,
    },
    componentProps: {
      options: [
        { label: '启用', value: 'true' },
        { label: '停用', value: 'false' },
      ],
    },
    required: true,
  },
];
